package threadScheduling;

public class join implements Runnable{

    @Override
    public void run() {
        for(int i =1;i<6;i++){
            System.out.println(Thread.currentThread().getName()+"输入了"+i);
        }
    }

    public static void main(String[] args) throws InterruptedException{
        // 创建线程
        Thread thread1 = new Thread(new join(),"thread1");
        thread1.start();
        for(int i=1;i<6;i++){
            System.out.println(Thread.currentThread().getName()+"输入"+i);
            if(i==2){
                thread1.join();
            }
        }
    }
}
